﻿#region Microsoft Public License
/*
 * (c) Copyright Zhun Qu. http://utablesdk.codeplex.com
 * 
 * This source is subject to the Microsoft Public License (Ms-PL).
 * Please see http://go.microsoft.com/fwlink/?LinkID=131993 for details.
 * All other rights reserved.
 */
#endregion

using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Windows;
using System.Windows.Media;

namespace UTable.Objects.Shapes
{
    public class ULine : UShape
    {
        #region Private Members

        private LineGeometry lineGeometry;

        #endregion

        #region Constructors

        public ULine()
        {
            lineGeometry = new LineGeometry();
        }

        #endregion

        #region Dependency Properties

        public static readonly DependencyProperty StartPointProperty = LineGeometry.StartPointProperty.AddOwner(typeof(ULine), new FrameworkPropertyMetadata(new Point(0, 0), FrameworkPropertyMetadataOptions.AffectsMeasure));
        public Point StartPoint
        {
            get { return (Point)GetValue(StartPointProperty); }
            set { SetValue(StartPointProperty, value); }
        }

        public static readonly DependencyProperty EndPointProperty = LineGeometry.EndPointProperty.AddOwner(typeof(ULine), new FrameworkPropertyMetadata(new Point(0, 0), FrameworkPropertyMetadataOptions.AffectsMeasure));
        public Point EndPoint
        {
            get { return (Point)GetValue(EndPointProperty); }
            set { SetValue(EndPointProperty, value); }
        }

        #endregion

        #region Override Methods

        protected override Geometry DefiningGeometry
        {
            get
            {
                lineGeometry.StartPoint = StartPoint;
                lineGeometry.EndPoint = EndPoint;
                return lineGeometry;
            }
        }

        #endregion
    }
}
